﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Text;

namespace WebApplication5
{
    public partial class WebForm5 : System.Web.UI.Page
    {
        private DataClassesOnlineCollegeManagementDataContext dc = new DataClassesOnlineCollegeManagementDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.GridView1.DataSource = this.dc.studentregisters.ToList();
                this.GridView1.DataBind();
            }
            
        }
       

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                studentregister stu = new studentregister();

                stu.fathername = this.TextBoxFa.Text;
                dc.studentregisters.InsertOnSubmit(stu);
                dc.SubmitChanges();
                this.GridView1.DataSource = this.dc.studentregisters.ToList();
                this.GridView1.DataBind();
            }
            catch (Exception)
            {

                Console.WriteLine("I dont expect this situation. Let the caller handle it");
                throw;
            }
        }
       
    }
}